package com.mp.beans;

import java.util.Optional;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.annotation.KafkaListener;

@Configuration
@EnableAutoConfiguration
public class MyListener {
	
	@KafkaListener(topics="testTopic")
	public void listen(String message){
		Optional<?> messages = Optional.ofNullable(message);
		if (messages.isPresent()) {
			System.out.println(messages.get());
		}
	}
	
	public void listen(ConsumerRecord<?, ?> record){
		Optional<?> message = Optional.ofNullable(record.value());
		if (message.isPresent()) {
			System.out.println(message.get());
		}
	}
	
	public void listen(){
		System.out.println("hello");
	}
	
}
